 import pandas as pd
# import matplotlib.pyplot as plt
# import seaborn as sns
# df=pd.read_excel('某地区上半年空气质量指数.xlsx')
# plt.figure(figsize=(8,4))
# sns.set_style(style='darkgrid',rc={'font.sans-serif':'SimHei'})
# sns.set_palette('bright')
# plt.subplot(2,1,1)
# sns.scatterplot(x='PM2.5',y='空气质量指数（AQI）',data=df)
# plt.title('PM2.5与空气质量指数散点图')
# plt.subplot(2,1,2)
# sns.scatterplot(x='PM10',y='空气质量指数（AQI）',data=df)
# plt.show()






# import pandas as pd
# import matplotlib.pyplot as plt
# df=pd.read_excel('某店铺促销方式分析.xlsx')
# plt.rcParams['font.sans-serif']='SimHei'
# plt.pie(x=df['购买人数'],labels=df['促销方式'],
#         autopct='%.2f%%',startangle=90,counterclock=False,
#         wedgeprops={'linewidth':1,'edgecolor':'white'})
# plt.title('某店铺不同促销方式下购买人数占比饼图')
# plt.show()






import pandas as pd
import matplotlib.pyplot as plt
file_path=r'男子体能测试成绩.xlsx'
data=pd.read_excel(file_path)
grades=data['成绩等级']
grade_counts=grades.value_counts()
plt.figure(figsize=(8,8))
plt.pie(grade_counts,autopct='%1.1f%%',startangle=90,pctdistance=0.9,textprops={'fontsize':13,'color':'w'})
plt.title('男子体能测试成绩等级占比饼图',fontsize=20)
plt.rcParams['font.sans-serif']='SimHei'
plt.legend(grade_counts.index)
plt.show()